package com.kg.project02.server.server.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kg.project02.server.server.Mapper.UserMapper;
import com.kg.project02.server.server.Model.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserService {

    @Resource
    UserMapper userMapper;

    public List<User> show_user(QueryWrapper<User> wrapper){
        return userMapper.selectList(wrapper);
    }

    public IPage<User> show_user_byPage(IPage<User> iPage, QueryWrapper<User> wrapper){
        return userMapper.selectPage(iPage,wrapper);
    }

    public int create_user(User user){
        return userMapper.insert(user);
    }

    public int delete_user(QueryWrapper<User> wrapper){
        return userMapper.delete(wrapper);
    }

    public int update_user(User user, UpdateWrapper<User> wrapper){
        return userMapper.update(user,wrapper);
    }
}
